package com.tc.data.test.strategy.repository;

import com.tc.data.common.annotation.Strategy;
import com.tc.report.StringUtils;

/**
 * 
 * ClassName: RepositoryShardingStategyById <br/>
 * Function: 根据id来获得分库标识. <br/>
 * date: 2016年12月8日 下午5:16:10 <br/>
 * 
 */
@Strategy("repositoryShardingStategyById")
public class RepositoryShardingStategyById extends BaseRepositoryShardingStrategy {
	@Override
	public String doGetReadWriteDataSource(Object obj) {
		String id = (String) obj;
		if(StringUtils.isBlank(id)){
			return "tc_test";
		}
		String dbNm = "tc_test_" + id;
		return dbNm;
	}
}
